<html><!-- Created using the cpp_pretty_printer from the dlib C++ library.  See http://dlib.net for updates. --><head><title>dlib C++ Library - misc_api_kernel_1.h</title></head><body bgcolor='white'><pre>
<font color='#009900'>// Copyright (C) 2004  Davis E. King (davis@dlib.net)
</font><font color='#009900'>// License: Boost Software License   See LICENSE.txt for the full license.
</font><font color='#0000FF'>#ifndef</font> DLIB_MISC_API_KERNEl_1_
<font color='#0000FF'>#define</font> DLIB_MISC_API_KERNEl_1_

<font color='#0000FF'>#ifdef</font> DLIB_ISO_CPP_ONLY
<font color='#0000FF'>#error</font> "<font color='#CC0000'>DLIB_ISO_CPP_ONLY is defined so you can't use this OS dependent code.  Turn DLIB_ISO_CPP_ONLY off if you want to use it.</font>"
<font color='#0000FF'>#endif</font>


<font color='#0000FF'>#include</font> "<a style='text-decoration:none' href='misc_api_kernel_abstract.h.html'>misc_api_kernel_abstract.h</a>"
<font color='#0000FF'>#include</font> "<a style='text-decoration:none' href='../algs.h.html'>../algs.h</a>"
<font color='#0000FF'>#include</font> <font color='#5555FF'>&lt;</font>string<font color='#5555FF'>&gt;</font>
<font color='#0000FF'>#include</font> "<a style='text-decoration:none' href='../uintn.h.html'>../uintn.h</a>"

<font color='#0000FF'>namespace</font> dlib
<b>{</b>

<font color='#009900'>// ----------------------------------------------------------------------------------------
</font>
    <font color='#0000FF'><u>void</u></font> <b><a name='sleep'></a>sleep</b> <font face='Lucida Console'>(</font>
        <font color='#0000FF'><u>unsigned</u></font> <font color='#0000FF'><u>long</u></font> milliseconds
    <font face='Lucida Console'>)</font>;

<font color='#009900'>// ----------------------------------------------------------------------------------------
</font>
    std::string <b><a name='get_current_dir'></a>get_current_dir</b> <font face='Lucida Console'>(</font>
    <font face='Lucida Console'>)</font>;

<font color='#009900'>// ----------------------------------------------------------------------------------------
</font>
    <font color='#0000FF'>class</font> <b><a name='set_current_dir_error'></a>set_current_dir_error</b> : <font color='#0000FF'>public</font> error
    <b>{</b>
    <font color='#0000FF'>public</font>:
        <b><a name='set_current_dir_error'></a>set_current_dir_error</b><font face='Lucida Console'>(</font>
            <font color='#0000FF'>const</font> std::string<font color='#5555FF'>&amp;</font> a
        <font face='Lucida Console'>)</font>: error<font face='Lucida Console'>(</font>a<font face='Lucida Console'>)</font> <b>{</b><b>}</b>
    <b>}</b>;

    <font color='#0000FF'><u>void</u></font> <b><a name='set_current_dir'></a>set_current_dir</b> <font face='Lucida Console'>(</font>
        <font color='#0000FF'>const</font> std::string<font color='#5555FF'>&amp;</font> new_dir
    <font face='Lucida Console'>)</font>;

<font color='#009900'>// ----------------------------------------------------------------------------------------
</font>
    <font color='#0000FF'>class</font> <b><a name='timestamper'></a>timestamper</b> 
    <b>{</b>
        <font color='#009900'>/*!
            INITIAL VALUE
                - last_time == 0
                - offset == 0
                - dword_max == 2^32

            CONVENTION
                - last_time == the time returned by GetTickCount() the last time we
                  called it.
                - offset == the number of microseconds we should add to the result of
                  GetTickCount() so that it is correct.
                - dword_max == 2^32.  
                  This is the number of values representable by a DWORD.  
        !*/</font>

        <font color='#0000FF'>mutable</font> <font color='#0000FF'><u>unsigned</u></font> <font color='#0000FF'><u>long</u></font> last_time;
        <font color='#0000FF'>mutable</font> uint64 offset;
        <font color='#0000FF'>mutable</font> uint64 dword_max;

    <font color='#0000FF'>public</font>:
        <b><a name='timestamper'></a>timestamper</b><font face='Lucida Console'>(</font>
        <font face='Lucida Console'>)</font> :
            last_time<font face='Lucida Console'>(</font><font color='#979000'>0</font><font face='Lucida Console'>)</font>,
            offset<font face='Lucida Console'>(</font><font color='#979000'>0</font><font face='Lucida Console'>)</font>
        <b>{</b>
            dword_max <font color='#5555FF'>=</font> <font color='#979000'>0xFFFFFFFF</font>;
            <font color='#5555FF'>+</font><font color='#5555FF'>+</font>dword_max;
        <b>}</b>

        uint64 <b><a name='get_timestamp'></a>get_timestamp</b> <font face='Lucida Console'>(</font>
        <font face='Lucida Console'>)</font> <font color='#0000FF'>const</font>;
    <b>}</b>;

<font color='#009900'>// ----------------------------------------------------------------------------------------
</font>
    <font color='#0000FF'>class</font> <b><a name='dir_create_error'></a>dir_create_error</b> : <font color='#0000FF'>public</font> error 
    <b>{</b>
    <font color='#0000FF'>public</font>:
        <b><a name='dir_create_error'></a>dir_create_error</b><font face='Lucida Console'>(</font>
            <font color='#0000FF'>const</font> std::string<font color='#5555FF'>&amp;</font> dir_name
        <font face='Lucida Console'>)</font> : 
            error<font face='Lucida Console'>(</font>EDIR_CREATE,"<font color='#CC0000'>Error creating directory '</font>" <font color='#5555FF'>+</font> dir_name <font color='#5555FF'>+</font> "<font color='#CC0000'>'.</font>"<font face='Lucida Console'>)</font>,
            name<font face='Lucida Console'>(</font>dir_name<font face='Lucida Console'>)</font>
        <b>{</b><b>}</b>

        ~<b><a name='dir_create_error'></a>dir_create_error</b><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font> <font color='#0000FF'>throw</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font> <b>{</b><b>}</b>
        <font color='#0000FF'>const</font> std::string name;
    <b>}</b>; 

    <font color='#0000FF'><u>void</u></font> <b><a name='create_directory'></a>create_directory</b> <font face='Lucida Console'>(</font>
        <font color='#0000FF'>const</font> std::string<font color='#5555FF'>&amp;</font> dir
    <font face='Lucida Console'>)</font>;

<font color='#009900'>// ----------------------------------------------------------------------------------------
</font>
<b>}</b>

<font color='#0000FF'>#ifdef</font> NO_MAKEFILE
<font color='#0000FF'>#include</font> "<a style='text-decoration:none' href='misc_api_kernel_1.cpp.html'>misc_api_kernel_1.cpp</a>"
<font color='#0000FF'>#endif</font>

<font color='#0000FF'>#endif</font> <font color='#009900'>// DLIB_MISC_API_KERNEl_1_
</font>

</pre></body></html>